<template>
  <div>
    <el-dialog title='提示' :visible="showDialog" width="30%" :before-close="handleClose" :close-on-click-modal="false">
      <div class="text-content">
        是否确认？
      </div>
      <span slot="footer" class="tip-footer">
        <el-button size="medium" class="cancel" @click="handleReject">驳 回</el-button>
        <el-button size="medium" class="addButton" type="primary" @click="handleSubmit">同 意</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import '../scss/index.scss'
import { updateApi } from '@/api/orderMange'
import TableCom from '@/components/TableCom'
export default {
  props: ['showDialog'],
  components: {
    TableCom,
  },
  data() {
    return {
      id: "",
      status: ""
    };
  },
  methods: {
    handleClose() {
      this.$emit('update:showDialog', false)
    },
    async handleSubmit() {
      await updateApi({ status: '2', id: this.id })
      this.$emit('handleRefresh')
      this.handleClose()
    },
    handleReject() {
      this.$confirm('是否确认驳回?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        await updateApi({ status: '4', id: this.id })
        this.$message({
          type: 'success',
          message: '已驳回!'
        });
        this.$emit('handleRefresh')
        this.handleClose()
      }).catch(() => {
      });
    },
  }
}
</script>

<style lang='scss' scoped>
.tip-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  padding: 0 20px;
}



.cancel {

  border-radius: 5px;
  position: relative;
  line-height: 20px;
  text-align: center;
  font-size: 14px;

  &:hover,
  &:focus {
    background: rgba($color: #e8f4ff, $alpha: 1) !important;
    border: 1px solid #0e7b67 !important;
    color: #0e7b67 !important;
  }

}
</style>
